package org.netty.http.server.config;

import org.netty.http.server.handler.HttpNettyServerHandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;

public class HttpServerChannelInit extends ChannelInitializer<SocketChannel> {
	
	 @Override
    protected void initChannel(SocketChannel channel) {
		 
        // 数据解码操作
        channel.pipeline().addLast(new HttpResponseEncoder());
        // 数据编码操作
        channel.pipeline().addLast(new HttpRequestDecoder());
        
        channel.pipeline().addLast(new HttpNettyServerHandler());
    }
}
